<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			function getAgeGroup(age) {
			  if (age < 0 || age > 60) {
			    return '年龄超出范围';
			  }
			 
			  if (age >= 0 && age <= 6) {
			    return '童年';
			  } else if (age >= 7 && age <= 17) {
			    return '少年';
			  } else if (age >= 18 && age <= 40) {
			    return '青年';
			  }else if (age >= 41 && age <= 65) {
			    return '中年';
			  }else {
			    return '老年';
			  }
			}
			 
			// 使用示例
			for (let i = 0; i <= 60; i++) {
			  console.log(i + '岁属于' + getAgeGroup(i));
			}
		</script>
	
	</body>
</html>
